//
// Created by htlin on 2021/3/2 0002.
//

#ifndef LIBUVTEST_THREADPOOL_H
#define LIBUVTEST_THREADPOOL_H

#include "header.h"

class ThreadPoolPrivateData;

class Runnable;

class ThreadPool {
public:
    explicit ThreadPool();

    virtual ~ThreadPool();

    void start(Runnable *runnable);

    void clear();

    void removeRequest(uv_work_t* request);

public:
    static int getMaxThreadCount();

    static void setMaxThreadCount(int count);

    static void removeRequestCB(uv_work_t* request, void *data);

private:
    void saveRequestData(uv_work_t *request);

private:
    std::unique_ptr<ThreadPoolPrivateData> data;
};


#endif //LIBUVTEST_THREADPOOL_H
